﻿@{
    Layout = null;
}
@model ElingOA6_Admin_DSJCJ.Model.SoftwareEntry
<!DOCTYPE html>

<html>
@Html.Partial("LoadPanelPartial")
<head>
    <title>SoftwareEntryEdit</title>
            @if (false)
    {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/PageCommon.js", true)" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>

     <script src="@Url.Content("~/Fckeditor/fckeditor.js", true)" type="text/javascript"></script>
     <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            if ($('#hidOldFileName').val() != "") {
                $('#spanOldFileName').empty().append($('#hidOldFileName').val());
            }
            if ($('#hidSvrFileName').val() != "") {
                $('#spanSvrName').empty().append($('#hidSvrFileName').val());
            }
            if ($('#hidOldFileName').val() != "" || $('#hidSvrFileName').val() != "") {
                $('#ImgBtn').css({ 'display': 'block' })
                $('#btnSoftAdd').css({ 'display': 'none' })
            }
            else {
                $('#ImgBtn').css({ 'display': 'none' })
                $('#btnSoftAdd').css({ 'display': 'block' })
            }

            $('#ImgBtn').click(function () {
                var _Svrfilename = $('#hidSvrFileName').val();
                $.ajax({
                    type: 'POST',
                    url: rootPath + '/Admin/SoftwareEntry/DeleteSoft',
                    data: { Svrfilename: _Svrfilename },
                    success: function (result) {
                        if (result == "success") {
                            $('#hidSvrFileName').val("");
                            $('#hidOldFileName').val("");
                            $('#spanOldFileName').empty();
                            $('#spanSvrName').empty();
                            $('#ImgBtn').css({ 'display': 'none' });
                            $('#btnSoftAdd').css({ 'display': 'block' })
                        }
                    }
                });


            })

        });




        $(document).ready(function () {
            $("#toolMenu").smartFloat();
            var hidjsAlert = $("#hidjsAlert").val();
            if (hidjsAlert != "") {
                alert(hidjsAlert);
            }

            var oFCKeditor = new FCKeditor('FNote');
            oFCKeditor.BasePath = rootPath + "/fckeditor/";
            oFCKeditor.ToolbarSet = "Basic";
            oFCKeditor.ReplaceTextarea();
        });

        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnSave":
                    {
                        //保存
                        save();
                        break;
                    }
                case "btnCancel":
                    {
                        //取消
                        window.location.href = rootPath + "/Admin/SoftwareEntry/SoftwareEntryContent";
                        break;
                    }
            }
        }

        function save() {
            lpModal.Show();
            var clientSoftwareNameObj = ASPxClientTextBox.Cast("FSoftwareName");
            var softwareName = clientSoftwareNameObj.GetText();
            if(pd(softwareName))
            {
                form1.submit();
            }
            else {
                lpModal.Hide();
            }
        }


        function addAttach() {
            var catalogID = $('#hidCatalogID').val();
            var str = window.showModalDialog(rootPath + "/Admin/SoftwareEntry/SoftwareEntryUpload?catalogID=" + catalogID, "软件上传", "dialogWidth=800px;dialogHeight=600px");
            if (str != "undefined" && str != null && str != "") {
                var abc = str.split(',');
                $('#hidSvrFileName').val(abc[0]);
                $('#hidSize').val(abc[1]);
                $('#hidOldFileName').val(abc[2]);
                $('#ImgBtn').css({ 'display': 'block' });
                $('#btnSoftAdd').css({ 'display': 'none' });
                $('#spanOldFileName').append(abc[2]);
                $('#spanSvrName').append(abc[0]);
                $('#hidHasUpload').val('Y');
            }

        }

        //判断
        function pd(softwareName) {
            var bl = true;
            if (softwareName == null || ASPxClientUtils.Trim(softwareName) == "") {
                FSoftwareName.SetErrorText("请填写软件名称！");
                FSoftwareName.SetIsValid(false);
                bl = false;
            }
            return bl;
        }


    </script>

        
    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)
</head>
<body>
@using (Html.BeginForm("EntrySave", "SoftwareEntry", FormMethod.Post, new { id = "form1" }))
{ 
        <div class="floatToolMenu" id="toolMenu">
            @Html.DevExpress().Menu(settings =>
      {
          settings.Name = "toolBarMenu";
          settings.ItemAutoWidth = false;
          settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
          settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
          settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);

          settings.Items.Add(item =>
          {
              item.Name = "btnSave";
              item.Text = "保存";
              item.ClientEnabled = true;
              item.Image.Url = Url.Content("~/Content/ControlImages/filesave.png");

          });
          settings.Items.Add(item =>
          {
              item.Name = "btnCancel";
              item.Text = "取消";
              item.ClientEnabled = true;
              item.Image.Url = Url.Content("~/Content/ControlImages/no.png");

          });
          settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
          settings.ItemLinkMode = ItemLinkMode.ContentBounds;
      }).GetHtml()
        </div>
    <div class="div">
        <table class="tableForm">
            <tr>
                <th>软件名称：</th>
                <td>
                    @Html.DevExpress().TextBox(settings =>
                    {
                        settings.Name = "FSoftwareName";
                        settings.Width = 200;
                        settings.Text = Model.FSoftwareName;
                        settings.Enabled = true;
                        settings.Properties.ValidationSettings.EnableCustomValidation = true;
                    }).GetHtml()
                </td>
                <th>使用平台：</th>
                <td>
                    @Html.DevExpress().TextBox(settings =>
                    {
                        settings.Name = "FPlatform";
                        settings.Width = 200;
                        settings.Text = Model.FPlatform;
                        settings.Enabled = true;
                        settings.Properties.ValidationSettings.EnableCustomValidation = true;
                    }).GetHtml()
                </td>
            </tr>
            <tr>
                <th>开发商：</th>
                <td>
                    @Html.DevExpress().TextBox(settings =>
                    {
                        settings.Name = "FDeveloper";
                        settings.Width = 200;
                        settings.Text = Model.FDeveloper;
                        settings.Enabled = true;
                        settings.Properties.ValidationSettings.EnableCustomValidation = true;
                    }).GetHtml()
                </td>
                <th>发布人：</th>
                <td>
                    @Html.DevExpress().TextBox(settings =>
                    {
                        settings.Name = "FPubEmpNo";
                        settings.Width = 200;
                        settings.Text = ViewData["emplName"].ToString();
                        settings.Enabled = false;
                        settings.Properties.ValidationSettings.EnableCustomValidation = true;
                    }).GetHtml()
                </td>
            </tr>
            <tr>
                <th>发布日期：</th>
                <td>
                    @Html.DevExpress().DateEdit(settings =>
                   {
                       settings.Name = "FPubDate";
                       settings.Properties.NullText = "";
                       settings.Width = 200;
                       settings.Date = Model.FPubDate;
                       settings.Properties.DisplayFormatString = "yyyy-MM-dd";
                       settings.Properties.EditFormatString = "yyyy-MM-dd";
                       settings.Enabled = false;

                   }).GetHtml()
                </td>
                <th>&nbsp;</th>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th>软件简介：</th>
                <td colspan="3">

                   @Html.TextArea("FNote", Model.FNote, new { @cols = "30", @rows = "10" })
                </td>
            </tr>
        </table>
    </div>
    <div class="div">
        <fieldset style="padding: 3px; margin: 3px;">
            <legend style="color: #06c;">
            软件上传
            </legend>
            <div style="text-align:center"><input id="btnSoftAdd" type="button" class="btn" value="增加软件" onclick="addAttach();" /></div>
            <table id="tableAttach" border="0" cellpadding="0" cellspacing="0" align="center" style="width: 95%;">
                <tr>
                    <td width="10%" align="center">
                        <img id="ImgBtn" src='@Url.Content("~/Content/images/delete.gif")' Width="9" Height="9" style="cursor:pointer;" />
                    </td>
                    <td width="30%" align="center">
                        <span id="spanOldFileName"></span>
                    </td>
                    <td width="60%" align="center">
                        <span id="spanSvrName"></span>
                    </td>
                </tr>
            </table>                             
        </fieldset>
    </div>
    
    @Html.Hidden("hidjsAlert", ViewData["jsAlert"])
    @Html.Hidden("hidAddType", ViewData["addType"])
    @Html.Hidden("hidCatalogID",ViewData["catalogID"])
    @Html.Hidden("hidPubEmpNo", Model.FPubEmpNo)
    @Html.Hidden("hidEntryID", ViewData["entryID"])

    @Html.Hidden("hidSvrFileName", ViewData["SvrFileName"])
    @Html.Hidden("hidSize", ViewData["Size"])
    @Html.Hidden("hidOldFileName", ViewData["OldFileName"])
    @Html.Hidden("hidHasUpload", ViewData["HasUpload"])    

}
    <script>
        lp.Hide();
    </script>
</body>
</html>
